package com.stylefeng.guns.rest.common.persistence.mapper;

import com.stylefeng.guns.api.cinema.vo.FilmInfoVo;
import com.stylefeng.guns.api.cinema.vo.HallInfoVo;
import com.stylefeng.guns.rest.common.persistence.model.MoocFieldT;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * 放映场次表 Mapper 接口
 * </p>
 *
 * @author zhaoluowei
 * @since 2019-09-15
 */
@Mapper
@Repository("moocFieldTMapper")
public interface MoocFieldTMapper extends BaseMapper<MoocFieldT> {


    List<FilmInfoVo> getFilmInfos(@Param("cineamId") int cineamId);

    @Select("SELECT \n" +
            "\tf.UUID AS hallFieldId,\n" +
            "  f.hall_name AS hallName,\n" +
            "  f.price AS price,\n" +
            "\thall.seat_address AS seatFile\n" +
            "FROM\n" +
            "  mooc_hall_dict_t hall,mooc_field_t f\n" +
            "WHERE\n" +
            "  f.hall_id = hall.UUID \n" +
            "AND\n" +
            "  f.UUID = #{fieldId}")
    HallInfoVo getHallInfoVo(@Param("fieldId") int fieldId);




    @Select("SELECT\n" +
            "\tf.film_id AS filmId,\n" +
            "\tinfo.film_name AS filmName,\n" +
            "\tinfo.film_length AS filmLength,\n" +
            "\tinfo.film_language AS filmType,\n" +
            "  info.film_cats AS filmCats,\n" +
            "\tinfo.actors AS actors,\n" +
            "\tinfo.img_address AS imgAddress\n" +
            "FROM\n" +
            "\tmooc_field_t f,mooc_hall_film_info_t info\n" +
            "WHERE\n" +
            "  f.film_id = info.film_id AND f.UUID = #{fieldId} \n")
    FilmInfoVo getFilmInfoVo(@Param("fieldId") int fieldId);



}
